/**
 * 
 */
package com.antilia.infomaresme.data.services;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import com.antilia.infomaresme.data.services.mock.FileUtils;

/**
 * @author Ernesto
 *
 */
public class FolderBasedImageDetail extends ImageDetail {

	private static final long serialVersionUID = 1L;
		
	private File file;
	
	/**
	 * 
	 */
	public FolderBasedImageDetail(File folder, String imageName) {
		this.file = new File(folder, imageName);
		
	}

	/* (non-Javadoc)
	 * @see com.antilia.infomaresme.data.services.ImageDetail#getBytes()
	 */
	@Override
	public byte[] getBytes() {
		try {
			return FileUtils.bytes(new FileInputStream(file));
		} catch (IOException e) {
			return null;
		}
	}

	public File getFile() {
		return file;
	}

}
